<template>
  <div :class="['nav-theme-${navTheme}', 'nav-layout-${navLayout}']">
    <a-layout id="components-layout-demo-side" style="min-height: 100vh">
      <a-layout-sider
        :theme="navTheme"
        v-if="navLayout === 'left'"
        width="256px"
        v-model="collapsed"
        collapsible
      >
        <div class="logo" />
        <Sider-menu :theme="navTheme" />
      </a-layout-sider>
      <a-layout>
        <a-layout-header style="background: #fff; padding: 0">
          <a-icon
            v-auth='["admin"]'
            class="collapsedCss"
            :type="collapsed ? 'menu-fold' : 'menu-unfold'"
            @click="collapsed = !collapsed"
          ></a-icon>
          <Header />
        </a-layout-header>
        <a-layout-content style="margin: 0 16px"> <router-view></router-view> </a-layout-content>
        <a-layout-footer style="text-align: center">
          <Footer />
        </a-layout-footer>
      </a-layout>
    </a-layout>
    <Authorized :authority="['admin']">
      <SetDrawer />
    </Authorized>
  </div>
</template>

<script>
import Header from "./Header";
import Footer from "./Footer";
import SiderMenu from "./SiderMenu";
import SetDrawer from "../components/SettingDrawer/Index";
export default {
  components: {
    Header,
    Footer,
    SiderMenu,
    SetDrawer
  },
  computed:{
     navTheme()
     {
         return this.$route.query.navTheme || 'dark'
     },
       navLayout()
     {
         return this.$route.query.navLayout || 'left'
     }
  },
  data() {
    return {
      collapsed: false,
    };
  },
};
</script>

<style>
#components-layout-demo-side .logo {
  height: 32px;
  background: rgba(255, 255, 255, 0.2);
  margin: 16px;
}
.collapsedCss {
  padding: 0px 20px;
  float: left;
  line-height: 64px;
}
.collapsedCss:hover {
  background-color: #eeeeee;
}
.logo {
  height: 64px;
  line-height: 64px;
  text-align: center;
  overflow: hidden;
}
.nav-theme-dark >>> .logo {
  color: #ffffff;
}
</style>